hackerrank solution for collections ordered dictionary